package com.cnhis.cloudhealth.clidoctorweb.cliparamter;

import java.util.Map;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.logging.Logger;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cnhis.cloudhealth.clinical.clidoctor.cliparamter.service.ICliparamter;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import com.cnhis.cloudhealth.commons.utils.JsonUtil;

import java.util.HashMap;
@SuppressWarnings("rawtypes")
@Path("cliparamter")
@Component
public class CliParamterRest {
	Logger log = Logger.getLogger(CliParamterRest.class); 
	@Reference
	private ICliparamter cliparamter;
	/* ScriptId(6429) */
	/* Description(提取本科、本人及共用的所有参数) */
	@SuppressWarnings("unchecked")
	@POST
	@Path("queryallpublicparamter")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo queryAllPublicParamter(@FormParam("ProductID") int ProductID,@FormParam("ProgramID") int ProgramID,@FormParam("UserID") int UserID,@FormParam("BCKID") int BCKID)throws Exception{
		HashMap hashMap = new HashMap();
		hashMap.put("ProductID", ProductID);
		hashMap.put("ProgramID", ProgramID);
		hashMap.put("UserID", UserID);
		hashMap.put("BCKID", BCKID);
		return cliparamter.queryAllPublicParamter(hashMap);
	}
	/* ScriptId(1334) */
	/* Description(判断操作员的业务范围，即是否医师、护士) */
	@POST
	@Path("operationscope")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo operationScope()throws Exception{
		return cliparamter.operationScope();
	}
	/* ScriptId(7353) */
	/* Description(诊疗收费对照收费方式) */
	@POST
	@Path("chargestandards")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo  chargeStandards()throws Exception{
		return cliparamter.chargeStandards();
	}
	/* ScriptId(7515) */
	/* Description(获取处方限制条件) */
	/**
	 * 
	 * @param BLP02 限制类型
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("prescriptionrestrictedcondition")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo prescriptionRestrictedCondition(@FormParam("BLP02") int BLP02)throws Exception{
		HashMap map = new HashMap();
		map.put("BLP02", BLP02);
		return cliparamter.prescriptionRestrictedCondition(map);
	}
	/* ScriptId(7743) */
	/* Description(检验危机值判断提醒) */
	/**
	 * 
	 * @param VAA01
	 * @param VAA07
	 * @param acf01
	 * @param adate 日期
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("checkcrisisvalue")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo checkCrisisValue(@FormParam("VAA01") int VAA01 ,
			@FormParam("productId") int productId,
			@FormParam("programId") int programId,
			@FormParam("paramNo") int paramNo,
			@FormParam("adate") String adate,
			@FormParam("VAA07") int VAA07,@FormParam("acf01") int acf01)throws Exception{
		HashMap map = new HashMap();
		map.put("VAA01", VAA01);
		map.put("VAA07", VAA07);
		map.put("acf01", acf01);
		map.put("adate", adate);
		map.put("productId", productId);
		map.put("programId", programId);
		map.put("paramNo", paramNo);
		return cliparamter.checkCrisisValue(map);
	}
	/* ScriptId(7732) */
	/* Description(门诊医保不让医疗类别) */
	/**
	 * 
	 * @param iaa01 机构id
	 * @param acf01 医疗服务
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clinicalunsupporthealthinsurance")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo clinicalUnsupportHealthInsurance(@FormParam("iaa01") int iaa01,@FormParam("acf01") int acf01)throws Exception{
		HashMap map = new HashMap();
		map.put("iaa01", iaa01);
		map.put("acf01", acf01);
		return cliparamter.clinicalUnsupportHealthInsurance(map);
	}
	/* ScriptId(7345) */
	/* Description(判断保险机构是否有对应疾病目录) */
	
	/**
	 * 
	 * @param IAA01 保险机构id
	 * @return 100,105002,271)
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("checkillnessmenu")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo checkIllnessMenu(@FormParam("IAA01") int IAA01,
			@FormParam("productId") int productId,
			@FormParam("programId") int programId,
			@FormParam("paramNo") int paramNo,
			@FormParam("currPage") int currPage,
			@FormParam("pageSize") int pageSize)throws Exception{
		HashMap map = new HashMap();
		map.put("IAA01", IAA01);
		map.put("productId", productId);
		map.put("programId", programId);
		map.put("paramNo", paramNo);
		return cliparamter.checkIllnessMenu(map, (currPage-1)*pageSize, pageSize);
	}
	/* ScriptId(2019) */
	/* Description(门诊首页病人基本信息) */
	/**
	 * VAA07 就诊id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clihomepagepatientbasicinfo")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo cliHomePagePatientBasicInfo(@FormParam("VAA07") long VAA07)throws Exception{
		HashMap map = new HashMap();
		map.put("VAA07", VAA07);
		return cliparamter.cliHomePagePatientBasicInfo(map);
	}
	/* ScriptId(7519) */
	/* Description(门诊首页过敏药物) */
	/**
	 * 
	 * @param VAA01 病人id
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("clihomepageallergy")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo cliHomePageAllergy(@QueryParam("params") String params)throws Exception{
		Map map = JsonUtil.getMap(params);
		return cliparamter.cliHomePageAllergy(map);
	}
	
	/**
	 * 过敏药物保存
	 * @param VAA01 病人id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("saveVal1")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo saveVal1(@FormParam("params") String params)throws Exception{
	    Map map = JsonUtil.getMap(params);
	    return cliparamter.saveVal1(map);
	}
	/* ScriptId(2021) */
	/* Description(门诊首页诊断记录  FSign 0 =新增; 1 = 不变 2 ＝ 修改  3 ＝ 删除) */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clihomepagetreatmentrecord")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo cliHomePageTreatmentRecord(@FormParam("VAA07") long VAA07)throws Exception{
		HashMap map = new HashMap();
		map.put("VAA07", VAA07);
		return cliparamter.cliHomePageTreatmentRecord(map);
	}
	/*Clinic_VAC1VAA1_Save*/
	/*门诊首页保存病人信息*/
	/**SET @Debug_lBCE01 =1
		lBCE03 = '系统管理员'
		lVAC01 =162
		lVAA01 =162
		lBCK01 =77
	 * 
	 * @param lXml
	 * @param lBCE01
	 * @param lBCE03
	 * @param lVAC01
	 * @param lVAA01
	 * @param lBCK01
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clihomepagesaveinfo")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo cliHomePageSaveInfo(
			@FormParam("lXml") String lXml,
			@FormParam("lBCE01") int lBCE01,
			@FormParam("lBCE03") String lBCE03,
			@FormParam("lVAC01") int lVAC01,
			@FormParam("lVAA01") int lVAA01,
			@FormParam("lBCK01") int lBCK01
			)throws Exception{
		HashMap map = new HashMap();
		map.put("lXml", lXml);
		map.put("lBCE01", lBCE01);
		map.put("lBCE03", lBCE03);
		map.put("lVAC01", lVAC01);
		map.put("lVAA01", lVAA01);
		map.put("lBCK01", lBCK01);
		return cliparamter.cliHomePageSaveInfo(map);
	}
	/* ScriptId(7518) */
	/* Description(门诊首页删除诊断) */
	/**
	 * 
	 * @param VAO01 诊断记录id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@GET
	@Path("deletetreatmentrecord")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo deleteTreatmentRecord(@QueryParam("VAO01") int VAO01)throws Exception{
		HashMap map = new HashMap();
		map.put("VAO01", VAO01);
		return cliparamter.deleteTreatmentRecord(map);
	}
	/* ScriptId(7505) */
	/* Description(门诊医师站首页界面元素设置) */
	@GET
	@Path("interfacesetting")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo interfaceSetting()throws Exception{
		return cliparamter.interfaceSetting();
	}
	/* ScriptId(7385) */
	/* Description(诊疗判断限制病人类别，开单科室条件) */
	@SuppressWarnings("unchecked")
	@POST
	@Path("interfacesetting")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo patientLimit(@FormParam("bbx01") int bbx01,@FormParam("bck01") int bck01,@FormParam("bdp02") int bdp02)throws Exception{
		HashMap map = new HashMap();
		map.put("bbx01", bbx01);
		map.put("bck01", bck01);
		map.put("bdp02", bdp02);
		return cliparamter.patientLimit(map);
		
	}
	//门诊首页病人信息打印
	/**
	 * 
	 * @param VAC01 就诊id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@GET
	@Path("patientinfoprint")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo patientInfoPrint(@QueryParam("VAC01") int VAC01)throws Exception{
		HashMap map = new HashMap();
		map.put("VAC01", VAC01);
		return cliparamter.patientInfoPrint(map);
	}
	/* ScriptId(2121) */
	/* Description(门诊首页删除入院信息，判断是否已经入院) */
	/**
	 * 
	 * @param VAA07 就诊id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@GET
	@Path("patientinfoprint")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo admittedHospital(@QueryParam("VAA07") int VAA07)throws Exception{
		HashMap map = new HashMap();
		map.put("VAA07", VAA07);
		return cliparamter.admittedHospital(map);
	}
	/* ScriptId(2122) */
	/* Description(门诊首页删除入院信息) */
	/**
	 * 
	 * @param BCE01 医师id
	 * @param BCE03 医师
	 * @param VAA07 就诊id
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("deleteadmittedhospital")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo deleteAdmittedHospital(@FormParam("BCE01") int BCE01,
			@FormParam("BCE03") String BCE03,
			@FormParam("VAA07") int VAA07)throws Exception{
		HashMap map = new HashMap();
		map.put("BCE01", BCE01);
		map.put("BCE03", BCE03);
		map.put("VAA07", VAA07);
		return cliparamter.deleteAdmittedHospital(map);
	}
	//保存设置参数
	//SavedOneUserParameters
	/**
	 * 
	 * @param ProductID
	 * @param ProgramID 
	 * @param ParamNo 编码
	 * @param UserID 用户id
	 * @param PName 参数名称
	 * @param PValue 参数值
	 * @param PDescrip 参数描述
	 * @param Privilege 授权
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("savedoneuserparameters")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo savedOneUserParameters(
			@FormParam("ProductID") int ProductID,
			@FormParam("ProgramID") int ProgramID,
			@FormParam("ParamNo") int ParamNo,
			@FormParam("UserID") int UserID,
			@FormParam("PName") String PName,
			@FormParam("PValue") String PValue,
			@FormParam("PDescrip") String PDescrip,
			@FormParam("Privilege") int Privilege
			)throws Exception{
		Map map = new HashMap();
		map.put("ProductID",ProductID);
		map.put("ProgramID",ProgramID);
		map.put("ParamNo",ParamNo);
		map.put("UserID",UserID);
		map.put("PName",PName);
		map.put("PValue",PValue);
		map.put("PDescrip",PDescrip);
		map.put("Privilege",Privilege);
		return cliparamter.savedOneUserParameters(map);
	}
	//修改限制条件参数
	//Clinic_BLP1_Edit
	/**
	 * 
	 * @param lXml 限制条件参数
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("execclinicblp1edit")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo execClinicBLP1Edit(@FormParam("lXml") String lXml)throws Exception{
		Map map = new HashMap();
		map.put("lXml",lXml);
		return cliparamter.execClinicBLP1Edit(map);
	}
	//修改限制条件参数验证
	@SuppressWarnings("unchecked")
	@POST
	@Path("validationclinicblp1editparams")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo validationClinicBLP1EditParams(@FormParam("lXml") String lXml)throws Exception{
		Map map = new HashMap();
		map.put("lXml",lXml);
		return cliparamter.validationClinicBLP1EditParams(map);
	}
	//修改病人类型参数
	//Clinic_BDP1_edit
	@SuppressWarnings("unchecked")
	@POST
	@Path("execclinicbdp1edit")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo execClinicBDP1edit(@FormParam("lxml") String lxml)throws Exception{
		Map map = new HashMap();
		map.put("lxml",lxml);
		return cliparamter.execClinicBDP1edit(map);
	}
	/* ScriptId(7495) */
	/* Description(门诊发送医嘱分单规则) */
	@GET
	@Path("sendadvicehacrule")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo sendAdviceHACRule()throws Exception{
		return cliparamter.sendAdviceHACRule();
	}
	/* ScriptId(7348) */
	/* Description(限定药品最大销售数量或金额) */
	@GET
	@Path("limitdrug")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo limitDrug()throws Exception{
		return cliparamter.limitDrug();
	}
	/* ScriptId(7394) */
	/* Description(发药机接口公司选择) */
	@GET
	@Path("automaticmedicineoption")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo  automaticMedicineOption()throws Exception{
		return cliparamter.automaticMedicineOption();
	}
	/* ScriptId(7331) */
	/* Description(偿付类别自定颜色设置) */
	@GET
	@Path("paytypeproperty")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo payTypeproperty()throws Exception{
		return cliparamter.payTypeproperty();
	}
	/* ScriptId(7339) */
	/* Description(给药途径限制滴速检索信息) */
	/**
	 * lBDA01 = 'T'
       lBBX13 = '2'
	 * @param lBDA01
	 * @param lBBX13
	 * @param aDate YYY-MM-DD
	 * @param para67
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("pathlimitoption")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo pathLimitOption(@FormParam("lBDA01") int lBDA01,@FormParam("lBBX13") int lBBX13,@FormParam("aDate") String aDate,@FormParam("para67") String para67)throws Exception{
		Map map = new HashMap();
		map.put("lBDA01",lBDA01);
		map.put("lBBX13",lBBX13);
		map.put("aDate",aDate);
		map.put("para67",para67);
		return cliparamter.pathLimitOption(map);
	}
	/* ScriptId(7506) */
	/* Description(病人类别扩展信息设置) */
	@GET
	@Path("patienttypeextends")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo patientTypeExtends()throws Exception{
		return cliparamter.patientTypeExtends();
	}
	/* ScriptId(7507) */
	/* Description(药品用药天数限制) */
	@GET
	@Path("limitmedicaldays")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo limitMedicalDays()throws Exception{
		return cliparamter.limitMedicalDays();
	}
	/* ScriptId(7484) */
	/* Description(分西成要处方，调整对应分类) */
	/**
	 * 
	 * @param BEH01 根码
	 * @param BDA01 编码
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("updatebda1")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo updateBDA1(@FormParam("BEH01") String BEH01,@FormParam("lBDA01") String lBDA01)throws Exception{
		HashMap map = new HashMap();
		map.put("BEH01", BEH01);
		map.put("lBDA01", lBDA01);
		return cliparamter.updateBDA1(map);
	}
	//Clinic_AAS1_edit
	//修改偿付类别
	/**
	 * 
	 * @param lXmlA sql
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("clinicaas1edit")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo clinicAAS1Edit(@FormParam("lXmlA") String lXmlA)throws Exception{
		HashMap map = new HashMap();
		map.put("lXmlA", lXmlA);
		return cliparamter.clinicAAS1Edit(map);
	}
	
	/**
	 * 药物过敏集合
	 */
	@POST
	@Path("guominList")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo guominList()throws Exception{
	    Map map = new HashMap();
	    return cliparamter.guominList(map);
	}
	/**
	 * 检索疾病参考诊断
	 */
	@GET
	@Path("jibingList")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo jibingList()throws Exception{
	    Map map = new HashMap();
	    return cliparamter.jibingList(map);
	}
	/**
	 * 诊断依据
	 */
	@GET
	@Path("yijuList")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo yijuList()throws Exception{
	    Map map = new HashMap();
	    return cliparamter.yijuList(map);
	}
	/**
	 * 病人首页—诊断结果
	 */
	@GET
	@Path("zhenduanjieguoList")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo zhenduanjieguoList()throws Exception{
	    Map map = new HashMap();
	    return cliparamter.zhenduanjieguoList(map);
	}
	/**
	 * 办理入园--过敏药物查询
	 */
	@GET
	@Path("queryGuominyaowu")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo queryGuominyaowu(@QueryParam("params") String params)throws Exception{
	    Map map = JsonUtil.getMap(params);
	    return cliparamter.queryGuominyaowu(map);
	}
}
